import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export const routes = [{
        path: '/',
        redirect: '/index'
    },
    {
        path: '/index',
        component: () => import('@/views/index'),
        children: [{
                path: '',
                component: () => import('@/views/search.vue')
            },
            {
                path: 'propertyClass',
                component: () => import('@/views/property-class.vue')
            },
            {
                path: 'propertyList',
                component: () => import('@/views/property-list.vue')
            },
            {
                path: 'propertyDetail',
                component: () => import('@/views/property-detail.vue')
            },
            {
                path: 'agents',
                component: () => import('@/views/agents.vue')
            },
            {
                path: 'aboutus/:id',
                component: () => import("@/views/aboutus.vue")
            }
        ]
    },

]

const router = new Router({
    routes
})

const VueRouterPush = Router.prototype.push
Router.prototype.push = function push(to) {
    return VueRouterPush.call(this, to).catch(err => err)
}

export default router